package com.atguigu.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Order(2)
public class InformAOP {

    @Pointcut("execution(public * com.atguigu..*.*(..))")
    public static void pointCutMethod(){}

    @Before("pointCutMethod()")
    public static void beforeMethod(JoinPoint joinPoint){
        System.out.println("beforeMethod..........");
    }

    @AfterReturning(value = "pointCutMethod()",returning = "result")
    public static void afterReturningMethod(JoinPoint joinPoint,Object result){
        System.out.println("afterReturningMethod..........");
    }

    @AfterThrowing(value = "pointCutMethod()",throwing = "exception")
    public static void afterThrowingMethod(JoinPoint joinPoint,Exception exception){
        System.out.println("afterThrowingMethod..........");
    }

    @After("pointCutMethod()")
    public static void afterMethod(JoinPoint joinPoint){
        System.out.println("afterMethod..........");
    }


}
